package com.cheegu.common.parser.gpsdata.parser;

import com.cheegu.common.parser.gpsdata.Parser;
import com.cheegu.common.parser.gpsdata.Unpacker;
import com.cheegu.common.parser.gpsdata.pojo.GpsDataEntity;
import com.cheegu.common.parser.gpsdata.unpacker.DefaultUnpacker;
import com.cheegu.common.parser.gpsdata.util.CodingUtils;

public class DefaultGpsDataParser implements Parser<GpsDataEntity> {
    @Override
    public GpsDataEntity parse(String data) {
        String hex = extractDataSection(data);
        byte[] bytes = CodingUtils.hex2bytes(hex);
        Unpacker unpacker = new DefaultUnpacker(0, bytes);

        return new GpsDataEntity();
    }

    protected String extractDataSection(String data) {
        return data.split("----")[1];
    }

}
